import { ResponseUtilService } from '@app/response-util';
import { Body, Controller, Post, Req } from '@nestjs/common';
import { DtoPipe } from 'apps/admin/src/pipe/dto/dto.pipe';
import { PageDto, RecahrgeDto } from './dto';
import { OrderService } from './order.service';

@Controller('recharge/order')
export class OrderController {
    constructor(
        private readonly service:OrderService
    ){}


    @Post('page')
    async page(@Body(new DtoPipe({skipMissingProperties : true})) dto:PageDto, @Req() req) {
        const result = await this.service.page(dto)

        return ResponseUtilService.successRes(result)

    }


    @Post('recharge')
    async recharge(@Body() dto:RecahrgeDto, @Req() req) {
        const result = await this.service.recharge(dto)
        return result ? ResponseUtilService.successRes() : ResponseUtilService.failRes()

    }
}
